package com.bayss.core;

/**
 * xin.pang
 */
public class DokoServerException extends RuntimeException {
    private DokoServerExceptionFactor factor;

    public DokoServerException(DokoServerExceptionFactor factor) {
        this(factor, factor.getErrorMsg());
    }

    public DokoServerException(DokoServerExceptionFactor factor, String message) {
        super((message == null ? factor.getErrorMsg() : message));
        this.factor = factor;
    }

    public DokoServerException(Exception e) {
        this(DokoServerExceptionFactor.DEFAULT, e.getMessage());
    }

    public DokoServerExceptionFactor getFactor() {
        return factor;
    }
}
